#ifndef INTERACTIONELEMENT_H_INCLUDED
#define INTERACTIONELEMENT_H_INCLUDED

#include "ConfigElement.h"

#include "KeyboardElement.h"
#include "MouseElement.h"
#include "HapticElement.h"
#include "InputElement.h"
#include "OutputElement.h"

#define INTERACTION_TAG         "interaction"




namespace OpenNano
{

    typedef std::map<std::string, KeyboardElement*> KeyboardsMap;
    typedef std::pair<std::string, KeyboardElement*> KeyboardsMapEntry;

    typedef std::map<std::string, InputElement*> InputsMap;
    typedef std::pair<std::string, InputElement*> InputsMapEntry;

    typedef std::map<std::string, OutputElement*> OutputsMap;
    typedef std::pair<std::string, OutputElement*> OutputsMapEntry;


    class OPENNANO_EXPORT InteractionElement : public ConfigElement
    {
        DECLARE_OBJECT_FACTORY( InteractionElement );

        private:
            bool _everything_is_good_so_far;
            KeyboardsMap    _keyboards;
            InputsMap       _inputs;
            OutputsMap      _outputs;
            MouseElement  * _mouse;
            HapticElement * _haptic;



        protected:
            void attributeFound(TiXmlAttribute * attribute );
            void childElementFound( TiXmlElement * childElement );
            void textFound(const char * text);
            bool postConfiguration();
            void init();

        public:
            const KeyboardsMap& getKeyboards() const;
            KeyboardElement * getKeyboard(const std::string& name);
            MouseElement * getMouse();
            HapticElement * getHapticDevice();
            const InputsMap& getInputs() const;
            InputElement * getInput(const std::string& name);
            const OutputsMap& getOutputs() const;
            OutputElement * getOutput(const std::string& name);

    };


}

#endif // INTERACTIONELEMENT_H_INCLUDED
